<template>
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">我的发票</block>
		</cu-custom>
		<view class="top-info" style="padding-top: 25px;">
			<view
				class="tn-margin tn-padding-left-sm tn-padding-bottom-xl tn-padding-top tn-color-white tn-text-center">
				<view>
					<text>总开票(元)</text>
					<text class="tn-icon-eye" style="opacity: 0.8; margin-left: 5px;">
					</text>
				</view>
				<view class="tn-text-bold tn-padding-top-xs" style="font-size: 35px;">129,086.82</view>
			</view>
			<view class="tn-color-white">
				<view class="tn-flex tn-flex-col-center tn-text-center">
					<view class="justify-content-item tn-flex-1">
						<view class="tn-text-sm" style="opacity: 0.6;">待开票(元)</view>
						<view class="tn-text-lg tn-text-bold tn-padding-top-xs">
							608.62</view>
					</view>
					<view class="justify-content-item tn-flex-1">
						<view class="tn-text-sm" style="opacity: 0.6;">待收款(元)
						</view>
						<view class="tn-text-lg tn-text-bold tn-padding-top-xs"> 26.09
						</view>
					</view>
					<view class="justify-content-item tn-flex-1">
						<view class="tn-text-sm" style="opacity: 0.6;">已收款 (元)
						</view>
						<view class="tn-text-lg tn-text-bold tn-padding-top-xs">1,506.22
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="cu-bar bg-white margin-top-xs">
			<view class="action sub-title">
				<text class="text-xl text-bold text-blue text-shadow">收款率</text>
				<text class="text-ABC text-blue">CollectionRate</text>
			</view>
		</view>
		<!-- <view class="chartsMain">
			<canvas canvas-id="canvasGauge" id="canvasGauge" class="charts"></canvas>
		</view> -->
		<view class="charts-box">
			<qiun-data-charts type="gauge" :opts="gaugeOpts" :chartData="chartGaugeData" />
		</view>


		<view class="cu-bar bg-white margin-top-xs">
			<view class="action sub-title">
				<text class="text-xl text-bold text-blue text-shadow">开票/收款</text>
				<text class="text-ABC text-blue">InvoicingCollection</text>
			</view>
		</view>
		<view class="charts-box">
			<qiun-data-charts type="column" :opts="opts" :chartData="chartTestData" />
		</view>


		<u-divider text="已经到底了"></u-divider>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				chartTestData: {},
				opts: {
					xAxis: {
						disableGrid: true
					},
					yAxis: {
						data: [{
							min: 0
						}]
					},
					extra: {
						column: {
							type: "group"
						}
					}
				},
				chartGaugeData: {},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['gauge'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				gaugeOpts: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: undefined,
					title: {
						name: "95%",
						fontSize: 25,
						color: "#2fc25b",
						offsetY: 50
					},
					subtitle: {
						name: "收款率",
						fontSize: 15,
						color: "#666666",
						offsetY: -50
					},
					extra: {
						gauge: {
							type: "default",
							width: 30,
							labelColor: "#666666",
							startAngle: 0.75,
							endAngle: 0.25,
							startNumber: 0,
							endNumber: 100,
							labelFormat: "",
							splitLine: {
								fixRadius: 0,
								splitNumber: 10,
								width: 30,
								color: "#FFFFFF",
								childNumber: 5,
								childWidth: 12
							},
							pointer: {
								width: 24,
								color: "auto"
							}
						}
					}
				},

			};
		},
		onLoad() {
			this.getServerData();
		},
		computed: {

		},
		mounted() {

		},
		methods: {

			getServerData() {
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						categories: ["2020", "2021", "2022", "2023", "2024"],
						series: [{
								name: "开票金额",
								data: [35, 36, 31, 33, 13]
							},
							{
								name: "收款金额",
								data: [18, 27, 21, 24, 6]
							}
						]
					};
					this.chartTestData = JSON.parse(JSON.stringify(res));


					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res1 = {
						categories: [{
							"value": 0.2,
							"color": "#1890ff"
						}, {
							"value": 0.8,
							"color": "#2fc25b"
						}, {
							"value": 1,
							"color": "#f04864"
						}],
						series: [{
							name: "收款率",
							data: 0.95
						}]
					};
					this.chartGaugeData = JSON.parse(JSON.stringify(res1));




				}, 500);
			},


			// ucharts end

		}
	};
</script>

<style lang="scss" scoped>
	.top-info {
		position: relative;
		background: linear-gradient(90deg, #3668fc, #395acd);
		top: 0;
		width: 100%;
		height: 245px;
		transition: all .25s ease-out;
		z-index: -1;
	}

	.tn-color-white {
		color: #fff !important;
	}

	.tn-text-center {
		text-align: center;
	}

	.tn-padding-left-sm {
		padding-left: 10px;
	}

	.tn-padding-bottom-xl {
		padding-bottom: 25px;
	}

	.tn-padding-top {
		padding-top: 15px;
	}

	.tn-margin {
		margin: 15px;
	}

	.tn-text-bold {
		font-weight: 700;
	}


	.tn-padding-top-xs {
		padding-top: 5px;
	}

	.tn-text-center {
		text-align: center;
	}

	.tn-flex-col-center {
		align-items: center;
	}

	.tn-flex {
		display: -webkit-flex;
		display: flex;
	}

	.tn-flex-1 {
		flex: 1;
	}

	.charts-box {
		width: 100%;
		height: 450rpx;
		background: #fff;
		padding-top: 15rpx;
		background: #fff;
		margin-bottom: 24rpx;
		border-top: 2rpx solid #f2f2f2;
	}

	.chartsMain {
		width: 750rpx;
		height: 450rpx;
		padding-top: 15rpx;
		background: #fff;
		margin-bottom: 24rpx;
		border-top: 2rpx solid #f2f2f2;

		.charts {
			width: 750rpx;
			height: 450rpx;
			box-sizing: border-box;
		}
	}
</style>